// 路由
import { createRouter, createWebHistory } from "vue-router";
import Home from "@/components/NewHome.vue";
import About from "@/components/NewAbout.vue";
import User from "@/components/user/NewUser.vue";
import UserProfile from "@/components/user/UserProfile.vue";
import UserPosts from "@/components/user/UserPosts.vue";

const routes = [
  {
    path: "/",
    components: {
      default: Home,
      RightSidebar: UserPosts,
    },
  },

  {
    path: "/about",
    name: "about",
    component: About,
    alias: "/myAbout",
  },

  {
    path: "/users/:id(\\d+)",
    name: "user",
    component: User,
    props: true,
    children: [
      {
        path: "profile",
        component: UserProfile,
      },
      {
        path: "posts",
        component: UserPosts,
      },
    ],
  },
];
const router = createRouter({
  history: createWebHistory(),
  routes,
});

export default router;
